package demo;

import java.util.Scanner;

//Day07
public class Day06006 {
    public static void main(String[] args) {
        int[] arr=new int[6];
        int max,min,addNum;
        Scanner scanner=new Scanner(System.in);

        for(int i=0;i<6;i++){
            arr[i]=scanner.nextInt();
        }
        addNum=max=min=arr[0];
//        计算最大值，最小值，总和
        for(int i=1;i<6;i++){
            if(arr[i]>max)
                max=arr[i];
            if(arr[i]<min)
                min=arr[i];
            addNum+=arr[i];
        }
        System.out.println((addNum-max-min)/4);
    }
}
